// 用户相关接口
const userApi = {
  sendCode: (mobile) => `/user-service/user/code/${mobile}`,
  login: '/user-service/user/login',
  getUserInfo: (id) => `/user-service/user/${id}`
}

// 工单相关接口
const taskApi = {
  // 获取工单列表
  search: (params) => {
    const query = Object.entries(params)
      .filter(([_, value]) => value !== undefined && value !== '')
      .map(([key, value]) => `${key}=${value}`)
      .join('&')
    return `/task-service/task/search?${query}`
  },
  // 获取待办工单列表
  getPendingTasks: (params) => {
    const query = Object.entries(params)
      .filter(([_, value]) => value !== undefined && value !== '')
      .map(([key, value]) => `${key}=${value}`)
      .join('&')
    return `/task-service/task/search?${query}&status=1` // status=1 表示待办状态
  },
  // 获取工单详情
  getTaskDetail: (taskId) => `/task-service/task/search?taskCode=${taskId}`,
  // 获取工单状态列表
  getTaskStatus: '/task-service/task/status/list',
  // 接受工单
  acceptTask: (taskId) => `/task-service/task/accept/${taskId}`,
  // 完成工单
  completeTask: (taskId) => `/task-service/task/complete/${taskId}`,
  // 取消工单
  cancelTask: (taskId) => `/task-service/task/cancel/${taskId}`
}

module.exports = {
  userApi,
  taskApi
} 